package com.mnemonic.storage;

import java.util.List;

import com.mnemonic.Players;
import com.mnemonic.domain.Player;

/**
 * 玩家数据存储
 * 
 * @author lifeng
 * @date 2021/05/12
 */
public class PlayerStorageService extends AbstractStorageService<Player> {

    @Override
    public List<Player> list() {

        // 玩家的对战数据
        List<Player> datas = super.list();

        // 获得内置的玩家
        List<Player> players = Players.getPlayers();
        for (Player player : players) {
            for (Player data : datas) {
                if (player.getId().equals(data.getId())) {
                    player.initData(data);
                }
            }
        }
        return players;
    }
}
